<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<jsp:include page="../admin.jsp"></jsp:include>
<html>
<head>
<title></title>
<jsp:include page="../../../inc/js.jsp"></jsp:include>
<jsp:include page="../../../inc/css.jsp"></jsp:include>
<script type="text/javascript">
	$(function() {
		$("#update").button().click(function() {
			$("#f").ajaxSubmit(function(data){
				var o = jQuery.parseJSON(data);
					if(o.success){
						alert('操作成功！');
						parent.funMenu.location="funMenuList.do";
					}
					else
						alert('操作失败！'+o.err);
			});
			return false;
		});
		$("#add").button().click(function() {
			$("#f").clearForm();
			return false;
		});
		$("#funURL").button().click(function() {
			window.open('url.do?function_code=${o.code}','URL','width=500,height=600,toolbar=no,menubar=no,scrollbars=yes,resizable=no,location=no,status=no');
			return false;
		});
		$("#del").button().click(function() {
			$.get("deleteFunMenu.do?"+Math.random(), {code:$("#code").val()}, function(data) {
				var o = jQuery.parseJSON(data);
					if(o.success){
						$("#f").clearForm();
						alert('操作成功！');
						parent.funMenu.location="funMenuList.do";
					}
					else
						alert('操作失败！'+o.err);
			});
			return false;
		});
		$.get("getSelect.do", {
			type : 'YN',
			index:'${o.enabled}'
		}, function(data) {
			$("select#enabled").append(data);
		});
		$.get("getSelect.do", {
			type : 'YN',
			index:'${o.isLeaf}'
		}, function(data) {
			$("select#isLeaf").append(data);
		});
	});
</script>
</head>
<body>
<form action="saveFunMenu.do" id="f" method="post">
<table>
	<tr>
		<td>编码：</td>
		<td><input type="text" id="code" name="code" value="${o.code}"></td>
	</tr>
	<tr>
		<td>父节点编码：</td>
		<td><input type="text" id="pCode" name="pCode" value="${o.pCode}"></td>
	</tr>
	<tr>
		<td>名称：</td>
		<td><input type="text" id="name" name="name" value="${o.name}"></td>
	</tr>
	<tr>
		<td>URL：</td>
		<td><input type="text" id="url" name="url" value="${o.url}" class="long"></td>
	</tr>
	<tr>
		<td>是否是叶子节点：</td>
		<td>
			<select id="isLeaf" name="isLeaf"></select></td>
	</tr>
	<tr>
		<td>有效：</td>
		<td><select id="enabled" name="enabled"></select></td>
	</tr>
	<tr>
		<td colspan="2">
		<center>
		<button id="update">保存</button>
		<button id="add">新建</button>
		<button id="funURL">URL</button>
		<button id="del">删除</button>
		</center>
		</td>
	</tr>
</table>
</form>

</body>
</html>



